import Home from '@/views/Home'
import Search from '@/views/Search'
import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const router = new VueRouter({
    /*
    使用动态路由传参时，需要对路径进行修改
    所以说，两种传参方式，只能存在一种
    ① 查询参数传参 -> 适合传多个参数
    ② 动态路由传参 -> 适合少个参数
    */
    routes: [
        {path: '/home', component: Home},
        /* /:words? 问号表示参数可选 */
        {path: '/search/:words?', component: Search},
    ]
})

export default router